package com.evry.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.evry.domain.collateralitem.CollateralItem;
import com.evry.repository.CollateralItemDao;

@Service("collateralItemManager")
public class SimpleCollateralItemManager implements CollateralItemManager {

	@Autowired
	CollateralItemDao collateralItemDao;
	
	@Override
	public List<CollateralItem> getAllCollateralItems() {
		List<CollateralItem> collateralItems = collateralItemDao.getAllCollateralItems();
		for (CollateralItem collateralItem : collateralItems) {
			collateralItemDao.setMortgages(collateralItem);
			collateralItemDao.setMortgagors(collateralItem);
		}
		return collateralItems;
	}

}
